package com.mysoft.gfyx.marketdevelop.controller;

import com.mysoft.framework.modeling.dto.ListDataResult;
import com.mysoft.framework.modeling.dto.LoadDataParams;
import com.mysoft.framework.rpc.annotation.PubAction;
import com.mysoft.framework.rpc.annotation.PubService;
import com.mysoft.framework.rpc.contants.RequestPrefix;
import com.mysoft.gfyx.marketdevelop.controller.dto.GetOpportunityDetailRequestDto;
import com.mysoft.gfyx.marketdevelop.service.DeveloperCooperatorService;
import com.mysoft.gfyx.marketdevelop.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@PubService(value = "/searchWinBidPub", prefix = RequestPrefix.PUB)
public class SearchWinBidPubController {
    @Resource
    private SearchService searchService;

    @Autowired
    private DeveloperCooperatorService developerCooperatorService;

    /**
     * 搜索中标
     *
     * @param options
     * @return
     */
    @PubAction(value = "/winBidList", method = RequestMethod.POST)
    public ListDataResult winBidList(@RequestBody LoadDataParams options) {
        return searchService.loadSearchWinBidData(options);
    }

    /**
     * 中标详情
     *
     * @param dto
     * @return
     */
    @PubAction(value = "/getWinBidDetail", method = RequestMethod.POST)
    public Object getWinBidDetail(@RequestBody GetOpportunityDetailRequestDto dto) {
        return developerCooperatorService.getWinBidById(dto.getId());
    }
}
